#! -*- encoding: utf-8 -*-
print("""The prime factors of 13195 are 5, 7, 13 and 29.
What is the largest prime factor of the number 600851475143?""")
print("")

def largestPrimeFactor(n):
  max = n
  divisor = 2

  while (n >= divisor ** 2):
    if n % divisor == 0:
        max, n = n, n / divisor
    else:
        divisor += 1      

  return max

print largestPrimeFactor(600851475143)
